﻿using Microsoft.SharePoint.ApplicationPages.Calendar.RecurrenceRule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindStyle.SPCalendar.Pattern
{
    public class YearlyByFrequencyPattern : IPattern
    {
        public int Day { get; set; }
        public int Month { get; set; }

        public YearlyByFrequencyPattern()
        {
            this.Day = DateTime.Today.Day;
            this.Month = DateTime.Today.Month;
        }

        public string ToXML()
        {
            return string.Format("<yearly yearFrequency=\"1\" month=\"{0}\" day=\"{1}\" />",
                    this.Month,
                    this.Day);
        }


        public void FromRule(RecurrenceRule recurrence)
        {
            this.Month = recurrence.Month;
            this.Day = recurrence.Day;
        }
    }
}
